/*
 * AboutBox.java
 * somehow this page has got slightly 'corrupted' by rmh massing around with it
 * in netBeans and the GUI objects are not exposed in the same way as the other
 * dialogs in this app.
 */

package FRDL;

import java.util.ArrayList;
import javax.swing.DefaultListModel;
import org.jdesktop.application.Action;

public class AboutBox extends javax.swing.JDialog {
    private DefaultListModel loggerTypesModel = new DefaultListModel();

    public AboutBox(java.awt.Frame parent) {
        super(parent);
        initComponents();
        //getRootPane().setDefaultButton(closeButton);
        loadLoggers();

    }

    @Action public void closeAboutBox() {
        dispose();
    }

    @Action public void goToFlymicro() {
        //System.out.println("going!");
        BrowserLaunch.openURL(App.getResourceMap().getString("Application.homepage"));
        //URL url = new URL(App.getResourceMap().getString("Application.homepage"));
        //showDocument((url);
    }

    @Action public void goToFaiApprovals() {
        BrowserLaunch.openURL(App.getResourceMap().getString("Application.homepage"));
    }

    private void loadLoggers() {
        ArrayList ar = App.gpsLoggersMaster.getTypes();
        String temp = "";
        for (int i=0;i<ar.size();i++) {
            temp = App.gpsLoggersMaster.getValue(ar.get(i).toString(),"cimaApproval");
            loggerTypesModel.addElement(ar.get(i) + " (CIMA ref: " + temp + ")");
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        javax.swing.JButton closeButton = new javax.swing.JButton();
        javax.swing.JLabel appTitleLabel = new javax.swing.JLabel();
        javax.swing.JLabel versionLabel = new javax.swing.JLabel();
        javax.swing.JLabel appVersionLabel = new javax.swing.JLabel();
        javax.swing.JLabel homepageLabel = new javax.swing.JLabel();
        javax.swing.JLabel appDescLabel = new javax.swing.JLabel();
        javax.swing.JLabel imageLabel = new javax.swing.JLabel();
        javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
        javax.swing.JList supportedLoggersList = new javax.swing.JList();
        javax.swing.JLabel supportedLoggersLabel = new javax.swing.JLabel();
        javax.swing.JLabel faiApprovalsURLLabel = new javax.swing.JLabel();
        javax.swing.JButton flymicroButton = new javax.swing.JButton();
        javax.swing.JButton faiApprovalsButton = new javax.swing.JButton();
        javax.swing.JLabel homepageLabel1 = new javax.swing.JLabel();
        javax.swing.JLabel appVendorLabel1 = new javax.swing.JLabel();
        javax.swing.JLabel homepageLabel2 = new javax.swing.JLabel();
        javax.swing.JLabel appVendorLabel2 = new javax.swing.JLabel();
        javax.swing.JLabel jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(FRDL.App.class).getContext().getResourceMap(AboutBox.class);
        setTitle(resourceMap.getString("title")); // NOI18N
        setModal(true);
        setName("aboutBox"); // NOI18N
        setResizable(false);

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(FRDL.App.class).getContext().getActionMap(AboutBox.class, this);
        closeButton.setAction(actionMap.get("closeAboutBox")); // NOI18N
        closeButton.setName("closeButton"); // NOI18N

        appTitleLabel.setFont(appTitleLabel.getFont().deriveFont(appTitleLabel.getFont().getStyle() | java.awt.Font.BOLD, appTitleLabel.getFont().getSize()+4));
        appTitleLabel.setText(resourceMap.getString("Application.title")); // NOI18N
        appTitleLabel.setName("appTitleLabel"); // NOI18N

        versionLabel.setFont(versionLabel.getFont().deriveFont(versionLabel.getFont().getStyle() | java.awt.Font.BOLD));
        versionLabel.setText(resourceMap.getString("versionLabel.text")); // NOI18N
        versionLabel.setName("versionLabel"); // NOI18N

        appVersionLabel.setText(resourceMap.getString("Application.version")); // NOI18N
        appVersionLabel.setName("appVersionLabel"); // NOI18N

        homepageLabel.setFont(homepageLabel.getFont().deriveFont(homepageLabel.getFont().getStyle() | java.awt.Font.BOLD));
        homepageLabel.setText(resourceMap.getString("homepageLabel.text")); // NOI18N
        homepageLabel.setName("homepageLabel"); // NOI18N

        appDescLabel.setText(resourceMap.getString("appDescLabel.text")); // NOI18N
        appDescLabel.setName("appDescLabel"); // NOI18N

        imageLabel.setIcon(resourceMap.getIcon("imageLabel.icon")); // NOI18N
        imageLabel.setName("imageLabel"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        supportedLoggersList.setModel(loggerTypesModel);
        supportedLoggersList.setName("supportedLoggersList"); // NOI18N
        jScrollPane1.setViewportView(supportedLoggersList);

        supportedLoggersLabel.setFont(resourceMap.getFont("supportedLoggersLabel.font")); // NOI18N
        supportedLoggersLabel.setText(resourceMap.getString("supportedLoggersLabel.text")); // NOI18N
        supportedLoggersLabel.setName("supportedLoggersLabel"); // NOI18N

        faiApprovalsURLLabel.setFont(resourceMap.getFont("faiApprovalsURLLabel.font")); // NOI18N
        faiApprovalsURLLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        faiApprovalsURLLabel.setText(resourceMap.getString("faiApprovalsMsg"));
        faiApprovalsURLLabel.setName("faiApprovalsURLLabel"); // NOI18N

        flymicroButton.setAction(actionMap.get("goToFlymicro")); // NOI18N
        flymicroButton.setForeground(resourceMap.getColor("flymicroButton.foreground")); // NOI18N
        flymicroButton.setText(resourceMap.getString("Application.homepage"));
        flymicroButton.setBorder(null);
        flymicroButton.setFocusPainted(false);
        flymicroButton.setName("flymicroButton"); // NOI18N

        faiApprovalsButton.setAction(actionMap.get("goToFaiApprovals")); // NOI18N
        faiApprovalsButton.setForeground(resourceMap.getColor("faiApprovalsButton.foreground")); // NOI18N
        faiApprovalsButton.setText(resourceMap.getString("faiApprovalsUrl"));
        faiApprovalsButton.setBorder(null);
        faiApprovalsButton.setFocusPainted(false);
        faiApprovalsButton.setName("faiApprovalsButton"); // NOI18N

        homepageLabel1.setFont(homepageLabel1.getFont().deriveFont(homepageLabel1.getFont().getStyle() | java.awt.Font.BOLD));
        homepageLabel1.setText(resourceMap.getString("homepageLabel1.text")); // NOI18N
        homepageLabel1.setName("homepageLabel1"); // NOI18N

        appVendorLabel1.setText(resourceMap.getString("appVendorLabel1.text")); // NOI18N
        appVendorLabel1.setName("appVendorLabel1"); // NOI18N

        homepageLabel2.setFont(homepageLabel2.getFont().deriveFont(homepageLabel2.getFont().getStyle() | java.awt.Font.BOLD));
        homepageLabel2.setText(resourceMap.getString("homepageLabel2.text")); // NOI18N
        homepageLabel2.setName("homepageLabel2"); // NOI18N

        appVendorLabel2.setText(resourceMap.getString("appVendorLabel2.text")); // NOI18N
        appVendorLabel2.setName("appVendorLabel2"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 482, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 490, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(imageLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(appTitleLabel)
                            .addComponent(appDescLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
                            .addComponent(closeButton, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(supportedLoggersLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(versionLabel)
                                    .addComponent(homepageLabel1)
                                    .addComponent(homepageLabel)
                                    .addComponent(homepageLabel2))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(appVendorLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(flymicroButton)
                                    .addComponent(appVendorLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(appVersionLabel))
                                .addGap(20, 20, 20))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(faiApprovalsURLLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(faiApprovalsButton)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(imageLabel)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(appTitleLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(appDescLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(versionLabel)
                            .addComponent(appVersionLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(homepageLabel1)
                            .addComponent(appVendorLabel1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(homepageLabel2)
                            .addComponent(appVendorLabel2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(homepageLabel)
                            .addComponent(flymicroButton))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(supportedLoggersLabel)))
                .addGap(15, 15, 15)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(faiApprovalsButton)
                    .addComponent(faiApprovalsURLLabel))
                .addGap(14, 14, 14)
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(closeButton)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents


    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
    
}
